package com.caas.kovsh.service.impl;

import com.caas.kovsh.mapper.UserMapper;
import com.caas.kovsh.model.SysUser;
import com.caas.kovsh.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class UserServiceImpl implements IUserService {


    @Autowired
    private UserMapper userMapper;

    @Override
    public List<SysUser> getUserList() {
        return userMapper.getUserList();
    }

    @Override
    public String tableDemo() {
        List<String> listB = userMapper.getB();
        List<String> listA =  userMapper.getA();
        int jilu = 0;
        String str = "";
        for(String s1 : listB){
            for (String s2 : listB){
                if(s1.equals(s2))
                    continue;
                for (String a : listA){
                    List<String> listcon = userMapper.getCon(a);
                    if(listcon.contains(s1)&&listcon.contains(s2)){
                        jilu++;
                    }
                }
                str = "☆"+str + "\r\n "+s1+"和"+s2+"共出现了"+jilu+"次 |";
                jilu = 0;
            }
        }
        return str;
    }
}
